﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;
using Microhard.Protal.Models;
using Microhard.Protal.Resource;

namespace Microhard.Protal.Validators
{
    public class SiteInfoModelValidator : AbstractValidator<SiteInfoModel>
    {
        public SiteInfoModelValidator()
        {
            RuleSet("Insert", () =>
            {
                RuleFor(u => u.Key).NotEmpty().WithMessage(Msg.SiteInfo_NeedKey);
                RuleFor(u => u.Value).NotEmpty().WithMessage(Msg.SiteInfo_NeedValue);
            });

            RuleSet("Update", () =>
            {
                RuleFor(u => u.Key).NotEmpty().WithMessage(Msg.SiteInfo_NeedKey);
                RuleFor(u => u.Value).NotEmpty().WithMessage(Msg.SiteInfo_NeedValue);
            });

            RuleSet("Delete", () =>
            {

            });
        }
    }
}
